package md.NJavaBase;
import md.NJavaBase.INativeAdPlugin;
import md.NJavaBase.NJavaBase;
import md.NJavaBase.NativeAdMgr;

//oppo原生形式的插屏广告单例
public class CCNativeInterstitialSingle {

    //初始化，由原生层调用
    public static void Go(final String posID, final INativeAdPlugin adPlugin)
    {
        NJavaBase.getActivity().runOnUiThread(
            new Runnable() {
                @Override
                public void run() {
                    mAdMgr = new NativeAdMgr("CCOppoNativeSingle", posID,adPlugin);
                }
            }
        );
    }

    public static void StartLoad(final int delay)
    {
        NJavaBase.getActivity().runOnUiThread(
                new Runnable() {
                    @Override
                    public void run() {
                        mAdMgr.StartLoad(delay);
                    }
                }
        );
    }

    //广告是否准备就绪
    public static boolean IsReady()
    {
        return mAdMgr.IsReady();
    }


    //原生广告显示时被调用，用于统计曝光
    public static void NotifyShow(){
        NJavaBase.getActivity().runOnUiThread(
                new Runnable() {
                    @Override
                    public void run() {
                        mAdMgr.NotifyShow();
                    }
                }
        );
    }

    //按钮被点击，用于统计点击次数
    public static void NotifyBtnClick(){
        NJavaBase.getActivity().runOnUiThread(
                new Runnable() {
                    @Override
                    public void run() {
                        mAdMgr.NotifyBtnClick();
                    }
                }
        );
    }

    //通知关闭
    public static void NotifyClose(){
        NJavaBase.getActivity().runOnUiThread(
                new Runnable() {
                    @Override
                    public void run() {
                        mAdMgr.NotifyClose();
                    }
                }
        );
    }

    //获取图标的Url地址，无图标返回 ""
    public static String GetIconUrl(){return mAdMgr.GetIconUrl();}

    //获取大图的Url地址，无大图返回 ""
    public static String GetImgUrl(){return mAdMgr.GetImgUrl();}


    //"广告" 标签图片，无则返回 ""
    public static String GetLogUrl(){return mAdMgr.GetLogUrl();}

    //标题文本 ，无则返回 ""
    public  static String GetTitle(){return mAdMgr.GetTitle();}

    //描述文本，无则返回 ""
    public static String GetDesc(){return mAdMgr.GetDesc();}

    //点击按钮文本,无则返回 ""
    public static String GetClickBtnText(){return mAdMgr.GetClickBtnText();}


    static NativeAdMgr mAdMgr;
}
